package com.example.testdemo.douyin;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;

import com.example.testdemo.R;

/**
 * 防抖音录制按钮
 * Created by zhangwenxiang on 2018/7/24.
 */

public class DouyinReordBtnActivity extends Activity{
    private RecordVideoView recordVideoView;
    private int recordState;//录制状态 0.未录制 1.录制种 2.录制完成

    boolean isStart;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        View view = LayoutInflater.from(this).inflate(R.layout.activity_douyin_record_view, null);
        setContentView(view);
        recordVideoView = findViewById(R.id.viewState);
        recordVideoView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(recordState == 0){
                    recordVideoView.onStart();
                    recordState = 1;
                }else if(recordState == 1){
                    recordVideoView.onSuccess();
                    recordState = 0;
                }
//                if(isStart){
//                    isStart = false;
//                    recordVideoView.onStop();
//                }else{
//                    isStart = true;
//                    recordVideoView.onStart();
//                }
            }
        });
    }
}
